//
//  MNDRegisterDefaultCell.m
//  minidai
//
//  Created by Steven.Yung on 2017/5/6.
//  Copyright © 2017年 迷你金服. All rights reserved.
//

#import "MNDRegisterDefaultCell.h"

@implementation MNDRegisterDefaultCell

- (void)awakeFromNib {
    [super awakeFromNib];
    __weak __typeof(self)weakSelf = self;
    
    [self.tfInput bk_addEventHandler:^(id sender) {
        weakSelf.bottomLineView.backgroundColor = [UIColor colorWithRed:255/255.0 green:110/255.0 blue:63/255.0 alpha:1.0];
        
    } forControlEvents:UIControlEventEditingDidBegin];
    
    [self.tfInput bk_addEventHandler:^(id sender) {
        if (weakSelf.tfInput.text.length > 0) {
            weakSelf.tipLabel.hidden = NO;
            weakSelf.tipLabel.textColor = [UIColor colorWithRed:255/255.0 green:110/255.0 blue:63/255.0 alpha:1.0];
        }else {
            weakSelf.tipLabel.hidden = YES;
        }
        
    } forControlEvents:UIControlEventEditingChanged];
    
    [self.tfInput bk_addEventHandler:^(id sender) {
        if(weakSelf.tfInput.text.length <= 0) {
            weakSelf.tipLabel.hidden = YES;
        }
        weakSelf.tipLabel.textColor = [UIColor colorWithRed:203/255.0 green:203/255.0 blue:203/255.0 alpha:1.0];
        weakSelf.bottomLineView.backgroundColor = [UIColor colorWithRed:241/255.0 green:241/255.0 blue:241/255.0 alpha:1.0];
    } forControlEvents:UIControlEventEditingDidEnd];
    // Initialization code
}

- (IBAction)secretButtonAction:(UIButton *)sender {
    sender.selected = !sender.isSelected;
    [self.tfInput setSecureTextEntry:!sender.selected];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
